<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="common/include :: header('新增员工')" />
</head>
<body class="white-bg">
	<div class="wrapper wrapper-content animated fadeInRight ibox-content">
		<form class="form-horizontal m" id="form-employee-add">
			<div class="form-group">
				<label class="col-sm-3 control-label is-required">员工名称：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="name" id="name" required>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label is-required">员工邮箱：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="email" id="email" required>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label is-required">年龄：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="age" id="age" required>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">是否管理员：</label>
				<div class="col-sm-8">
					<div class="radio-box" th:each="dict : ${@dict.getType('si_visible')}">
						<input type="radio" th:id="${dict.id}" name="admin" th:value="${dict.value}" th:checked="${dict.isDefault}">
						<label th:for="${dict.id}" th:text="${dict.label}"></label>
					</div>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">部门：</label>
				<div class="col-sm-8">
					<select name="department.id" class="form-control m-b" >
						<option th:each="department:${departments}" th:text="${department.name}" th:value="${department.id}"></option>
					</select>
				</div>
			</div>
		</form>
	</div>
	<th:block th:include="common/include :: footer" />
	<script type="text/javascript">
		var prefix = ctx + "/business/employee";
	    
		$("#form-employee-add").validate({
		// 	onkeyup: false,
		// 	rules:{
		// 		name:{
		// 			remote: {
		//                 url: prefix + "/checkemployeeNameUnique",
		//                 type: "employee",
		//                 dataType: "json",
		//                 data: {
		//                 	"name" : function() {
		//                         return $.common.trim($("#employeeName").val());
		//                     }
		//                 },
		//                 dataFilter: function(data, type) {
		//                 	return $.validate.unique(data);
		//                 }
		//             }
		// 		},
		// 		code:{
		// 			remote: {
		//                 url: prefix + "/checkemployeeCodeUnique",
		//                 type: "employee",
		//                 dataType: "json",
		//                 data: {
		//                 	"code" : function() {
		//                         return $.common.trim($("#employeeCode").val());
		//                     }
		//                 },
		//                 dataFilter: function(data, type) {
		//                 	return $.validate.unique(data);
		//                 }
		//             }
		// 		},
		// 		employeeSort:{
		// 			digits:true
		// 		},
		// 	},
		// 	messages: {
		//         "code": {
		//             remote: "员工编码已经存在"
		//         },
		//         "name": {
		//             remote: "员工名称已经存在"
		//         }
		//     },
		//     focusCleanup: true
		});
		
		function submitHandler() {
	        // if ($.validate.form()) {
	        	$.operate.save(prefix + "/add", $('#form-employee-add').serialize());
	        // }
	    }
	</script>
</body>
</html>
